<div class="alert-title">查看会员信息</div>

<table class="am-table am-table-bordered am-table-radius am-table-striped .am-table-compact user-info">
    <tr>
        <td class="title">用户名</td>
        <td class="field ui_uid">
        </td>
        <td width="60px"><button value="mobile">复制</button></td>
    </tr>

    <tr>
        <td class="title">真实姓名</td>
        <td class="field ui_name">
        </td>
        <td width="60px"><button value="name">复制</button></td>
    </tr>

    <tr>
        <td class="title">会员组</td>
        <td class="field ui_grade">
        </td>
        <td></td>
    </tr>

    <tr>
        <td class="title">上级代理</td>
        <td class="field ui_daili">
        </td>
        <td></td>
    </tr>

    <tr>
        <td class="title">QQ</td>
        <td class="field ui_qq">
        </td>
        <td width="60px"><button value="qq">复制</button></td>
    </tr>

    <tr>
        <td class="title">微信</td>
        <td class="field ui_wechat">
        </td>
        <td width="60px"><button value="wechat">复制</button></td>
    </tr>

    <tr>
        <td class="title">手机号</td>
        <td class="field ui_phone">
        </td>
        <td width="60px"><button value="phone">复制</button></td>
    </tr>
    
    <tr>
        <td class="title">邮箱</td>
        <td class="field ui_email">
        </td>
        <td></td>
    </tr>

    <tr>
        <td class="title">开户行</td>
        <td class="field ui_bank">
        </td>
        <td width="60px"><button value="bank">复制</button></td>
    </tr>
    <tr>
        <td class="title">开户地址</td>
        <td class="field ui_bank_addr">
        </td>
        <td width="60px"><button value="bank_addr">复制</button></td>
    </tr>
    <tr>
        <td class="title">卡号</td>
        <td class="field ui_bank_account">
        </td>
        <td width="60px"><button value="bank_account">复制</button></td>
    </tr>

    <tr>
        <td class="title">账户余额</td>
        <td class="field ui_balance">
            0.00
        </td>
        <td></td>
    </tr>

    <tr>
        <td class="title">打水余额</td>
        <td class="field ui_dw">
            0.00
        </td>
        <td></td>
    </tr>

    <tr>
        <td class="title">今日存款/取款</td>
        <td class="field ui_today_deposit">
            0.00/0.00
        </td>
        <td></td>
    </tr>

    <tr>
        <td class="title">存款/取款总次数</td>
        <td class="field ui_amount">
            0/0
        </td>
        <td></td>
    </tr>

    <tr>
        <td class="title">投注/中奖总额</td>
        <td class="field ui_consume">
            0.00
        </td>
        <td></td>
    </tr>

    <tr>
        <td class="title">总注单数</td>
        <td class="field ui_bet_count">
        </td>
        <td></td>
    </tr>

    <tr>
        <td class="title">奖励/惩罚总额</td>
        <td class="field ui_reward">
            0.00
        </td>
        <td></td>
    </tr>

    <tr>
        <td class="title">返水总额</td>
        <td class="field ui_back">
        </td>
        <td></td>
    </tr>

    <tr>
        <td class="title">存款/取款总额</td>
        <td class="field ui_deposit">
        </td>
        <td></td>
    </tr>

    <tr>
        <td class="title">注单总输赢</td>
        <td class="field ui_win_lost">
        </td>
        <td></td>
    </tr>

    <tr>
        <td class="title">在线</td>
        <td class="field ui_online">
        </td>
        <td></td>
    </tr>

    <tr>
        <td class="title">账户状态</td>
        <td class="field ui_state">
        </td>
        <td></td>
    </tr>

    <tr>
        <td class="title">IP</td>
        <td class="field ui_ip">
        </td>
        <td width="60px"><button value="ip">复制</button></td>
    </tr>

    <tr>
        <td class="title">登录时间</td>
        <td class="field ui_login">
        </td>
        <td></td>
    </tr>

    <tr>
        <td class="title">注册时间</td>
        <td class="field ui_register">
        </td>
        <td></td>
    </tr>
</table>
<style type="text/css">
    .user-info .title {
        width: 120px !important;
        padding: 0px !important;
        text-align: center;
    }
</style>

<script>
    $(".button_line .close").click(function() {
        $("#user_detail_page").remove();
    });
    $("#popup-page").click(function() {
        $("#user_detail_page").remove();
    });
    $(".user-info").click(function(e) {
        e.stopPropagation();
    });

    var user = context.center.user;
    var account = {};
    for (var i in user.account) {
        if (user.account[i].owner == '') {
            account = user.account[i];
            break;
        }
    }
    $(".ui_uid").html(user.mobile || '');
    $(".ui_name").html(user.name || '');
    $(".ui_grade").html(Rights.roles[user.grade || "1"]);
    $(".ui_daili").html(user.referee || '无');
    $(".ui_qq").html(user.qq || '');
    $(".ui_email").html(user.email2 || '');
    $(".ui_wechat").html(user.wechat || '');
    $(".ui_phone").html(user.phone || '');
    $(".ui_balance").html((user.balance/100).toFixed(2));
    $(".ui_dw").html(((account.dw || 0)/100).toFixed(2));
    $(".ui_consume").html("<span class='red'>" + (account.consume/100).toFixed(2) + 
        "</span>/<span class='blue'>" + ((user.betWin || 0)/100).toFixed(2) + "</span>");
    $(".ui_reward").html("<span class='red'>" + (account.reward/100).toFixed(2) + 
        "</span>/<span class='blue'>" + (account.penalty/100).toFixed(2) + "</span>");
    $(".ui_deposit").html("<span class='red'>" + (account.deposit/100).toFixed(2) + 
        "</span>/<span class='blue'>" + (account.withdraw/100).toFixed(2) + "</span>");
    $(".ui_online").html(user.online == 1 ? "是" : "否");
    $(".ui_state").html(user.state == 0 ? "正常" : "冻结");
    $(".ui_ip").html(user.ip || '');
    $(".ui_login").html(user.login ? new Date(user.login).Format("yyyy-MM-dd HH:mm") : '');
    $(".ui_register").html(user.register ? new Date(user.register).Format("yyyy-MM-dd HH:mm") : '');
    $(".ui_amount").html("<span class='red'>" + (user.depositCount || 0) + 
        "</span>/<span class='blue'>" + (user.withdrawCount || 0) + "</span>");
    $(".ui_today_deposit").html("<span class='red'>" + ((user.depositToday || 0)/100).toFixed(2) + 
        "</span>/<span class='blue'>" + ((user.withdrawToday || 0)/100).toFixed(2) + "</span>");
    $(".ui_today_bet").html(((user.betSum || 0)/100).toFixed(2));
    $(".ui_bet_count").html(((user.betCount || 0)));
    $(".ui_back").html(((account.back || 0)/100).toFixed(2));
    $(".ui_state").html(user.state == 0 ? "正常" : "冻结");

    if (user.ip) {
        CMD.ip_info(user.ip, function(r) {
            $(".ui_ip").html(user.ip + "(" + r.addr + ")");
        })
    }

    // 计算总输赢
    var v = user.betWin - user.betSum;
    //if (user.betProfit) v += user.betProfit;
    $(".ui_win_lost").html((v/100).toFixed(2));

    // 银行卡
    var bankContent = '';
    var _bank_data;
    if (user.bank) {
        var b = JSON.parse(user.bank);
        _bank_data = b;
        $(".ui_bank").html(b.bank || '');
        $(".ui_bank_addr").html(b.addr || '');
        $(".ui_bank_account").html(b.account || '');
    }

    // 复制的逻辑
    $(".user-info td button").click(function(e) {
        var s = '';
        var field = $(e.currentTarget).attr("value");
        if (field == 'bank') {
            if (_bank_data) s = _bank_data.bank;
        }
        else if (field == "bank_addr") {
            if (_bank_data) s = _bank_data.addr;
        }
        else if (field == "bank_account") {
            if (_bank_data) s = _bank_data.account;
        }
        else if (field == "ip") {
            if (_bank_data) s = user.ip;
        }
        else
            s = user[field];
        superClipBoard.copy(s);
    });
</script>